package com.taxi.util;

import java.sql.*;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class MySqlDBConn {
	/**
	 *Permite Cargar en Memoria los Drivers 
	 */
	public Connection getConnection() {
		
		Connection connection=null;
		try{
			//JNDI
			Context context=new InitialContext();
			Context contextJava=(Context)context.lookup("java:comp/env");
			DataSource ds=(DataSource)contextJava.lookup("dsTaxi");
			connection=ds.getConnection();
		}catch (Exception e) {
			connection=null;
		}
		return connection;
	}

	
}
